package com.lej.dataservice.club.data

import com.lej.core.base.BaseModel
import com.lej.core.common.LogTags
import com.lej.core.utils.extention.logI
import com.lej.core.utils.reportIt
import com.lej.dataservice.club.http.baseApiService
import com.lej.dataservice.club.http.checkData
import com.lej.dataservice.club.http.checkToken

class PengRepository : BaseModel() {
    /**
     * 获取公众号
     */
    suspend fun getPubNum() =
        runCatching { baseApiService.kefuinfo()?.checkData()?.kefuweixin }
            .onFailure {
            "获取公众号失败".logI(LogTags.setting)
            it.printStackTrace()
            it.reportIt()
        }.getOrNull()

    /**获取七牛token*/
    suspend fun getQNToken() =
        runCatching { baseApiService.qnToken().checkToken() }
            .onFailure { "获取公众号失败".logI(LogTags.setting) }.getOrNull()
}